﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace The_LarX
{
    public class VSR_Object : VSRBase
    {
        public VSR_Object()
        {
        }
        public override void Start(VisualScript_Node Node, VisualScriptEditor editor)
        {
            this.Node = Node;
            this.Editor = editor;

            this.RightRectangle = new RectangleOwner(this, new Rectangle(), null, ExpectedNode.Object);
            editor.Rectangles.Add(RightRectangle);

            UpdateSizeAndPos();
        }

        public override void UpdateSizeAndPos()
        {
            RightRectangle.Rectangle.X = (int)Position.X + (((int)Size.X / 2) - RightRectSize / 2);
            RightRectangle.Rectangle.Y = (int)Position.Y;
            RightRectangle.Rectangle.Width = RightRectSize;
            RightRectangle.Rectangle.Height = RightRectSize;

            SmallerRectangle.X = (int)Position.X;
            SmallerRectangle.Y = (int)Position.Y;
            SmallerRectangle.Width = (int)Size.X;
            SmallerRectangle.Height = (int)Size.Y;
            BiggerRectangle.X = (int)Position.X - LineSize;
            BiggerRectangle.Y = (int)Position.Y - LineSize;
            BiggerRectangle.Width = (int)Size.X + (LineSize * 2);
            BiggerRectangle.Height = (int)Size.Y + (LineSize * 2);
        }

        public override void Draw()
        {
            Engine.RenderManager.DrawRectangle(Color.Black, BiggerRectangle, Camera);
            Engine.RenderManager.DrawRectangle(Color.Gray, SmallerRectangle, Camera);

            RightRectangle.Draw(Camera);

            Engine.RenderManager.DrawString(Node.DescriptionName, 2, 200,
                new Vector2(Position.X + Size.X / 10, Position.Y + Size.Y / 10), "Kootenay",
                Color.White, Camera, 0, Vector2.Zero, 0.4f, 0);
        }
    }
}
